package cn.wolfcode.trip.base.domain;


import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.*;

import java.util.HashMap;

@Setter
@Getter
@ToString
@NoArgsConstructor
@AllArgsConstructor
//大攻略
public class Strategy extends BaseDomain{

    public static final Integer STATE_NOMAL = 0; //正常
    public static final Integer STATE_DISABLE = 1; //禁用
    public static final Integer STATE_COMMEND = 2; //推荐

    private String title;

    private String subTitle;

    private String coverUrl;

    private Integer state=STATE_NOMAL;
    //区域
    private Region place;


    public String getStateName() {
        String str="正常";
        if (state==STATE_DISABLE) {
            return str="禁用";
        }else if (state==STATE_COMMEND) {
            return str="推荐";
        }
        return str;
    }

    public String getJson() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("title", title);
        map.put("subTitle", subTitle);
        map.put("coverUrl", coverUrl);
        if(place!=null){
            map.put("placeId", place.id);
        }
        map.put("state", state);
        return JSONUtil.toJSONString(map);
    }
}